<?
require_once (__DIR__ . '/../../models/Products.php');

if(isset($_POST['id'])) {
  $response = Products::Delete($_POST['id']);
  if ($response === true) {
    header('Location: ' . $rootUrl . '/../W/Products/?removed');
    die();
  }
}
	$row = Products::Get($_REQUEST['id']);
?>


				<? if(isset($response)): ?>
					<dl class="dl-horizontal error">
						<? foreach ($response as $key => $value) { ?>
							<dt><?=$key?></dt>
							<dd><?=$value?></dd>
						<? } ?>						
					</dl>
				<? endif; ?>
				<form method="post" action="delete">
					<h2>Are you Sure?</h2>
					<p>
						Would you like to delete <?=$row['Name']?>?
					</p>
					<input type="hidden" name="id" value="<?=$row['id']?>" />
				    <div class="modal-footer">
						<input type="submit" value="Delete" class="btn btn-primary" />
					</div>
				</form>
				
			</div>
			<? include('../../inc/footer.php'); ?>
		</div>
